﻿Public Class modify_username

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If TextBox1.Text = "" Or TextBox2.Text = "" Then
            MsgBox("Supply all Fields")
        Else
            If TextBox2.Text.Length > 10 Or TextBox2.Text.Length < 5 Then
                MsgBox("Username should be 5 to 10 characters only")
            Else
                rs = New ADODB.Recordset
                rs.Open("SELECT * from account where password = '" & TextBox1.Text & "'", cn, 3, 2)
                rs.Fields("Username").Value = TextBox2.Text
                rs.Update()
                rs.Close()
                rs = Nothing
                MsgBox("Successfully Updated")
                MainScreen.Show()
                Me.Close()
            End If
        End If



    End Sub

    Private Sub modify_username_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Module1.connect()
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        accountmgnt.Show()
        Me.Hide()
    End Sub

    Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged

    End Sub
End Class